*****************************************************
* Mexico Pollfish Survey            				*
* E1 Survey Experiment      				        *
* Ana López García, Sarah Berens & Barry Maydom 	*
* July 2023                                         *
* 		                            				*
* ANALYSIS                                          *
* Pollfish Mexico Survey Dec 31-Jan2nd 21/22        *
*****************************************************

*CHECK - Set directory

use "Data/Data ready E1.dta", clear 

*******************************************************
**4.1 DATA ANALYSIS - FULL SAMPLE 
**4.2 DATA ANALYSIS - SUBGROUP ANALYSIS
******4.2A Nonmigrant vs Migrant 
******4.2B Nonmigrant vs Return and Nonreturning migrant
******4.2C Nonmigrant vs US Context
***********4.2c.1 Medicaid
***********4.2c.2 Obamacare
***********4.2c.3 Social assistance to migrants
***********4.2c.4 Everify
***********4.2c.5 Local immigration enforcement.
*******************************************************

************************************
*4.1 DATA ANALYSIS - FULL SAMPLE
************************************

*Regression Results 

*OLS regression with effect coding variables
reg E1_pay_taxes e1_vign1_VAT_effect e1_vign1_PIT_effect e1_vign2_health_effect e1_vign2_roads_effect e1_vign2_security_effect ///
	c.e1_vign1_VAT_effect#c.e1_vign2_health_effect c.e1_vign1_VAT_effect#c.e1_vign2_roads_effect c.e1_vign1_VAT_effect#c.e1_vign2_security_effect ///
	c.e1_vign1_PIT_effect#c.e1_vign2_health_effect c.e1_vign1_PIT_effect#c.e1_vign2_roads_effect c.e1_vign1_PIT_effect#c.e1_vign2_security_effect

*Probit regression with effect coding variables
oprobit E1_pay_taxes e1_vign1_VAT_effect e1_vign1_PIT_effect e1_vign2_health_effect e1_vign2_roads_effect e1_vign2_security_effect /// 
	c.e1_vign1_VAT_effect#c.e1_vign2_health_effect c.e1_vign1_VAT_effect#c.e1_vign2_roads_effect c.e1_vign1_VAT_effect#c.e1_vign2_security_effect /// 
	c.e1_vign1_PIT_effect#c.e1_vign2_health_effect c.e1_vign1_PIT_effect#c.e1_vign2_roads_effect c.e1_vign1_PIT_effect#c.e1_vign2_security_effect

*Logit regression with effect coding variables
ologit E1_pay_taxes e1_vign1_VAT_effect e1_vign1_PIT_effect e1_vign2_health_effect e1_vign2_roads_effect e1_vign2_security_effect ///
	c.e1_vign1_VAT_effect#c.e1_vign2_health_effect c.e1_vign1_VAT_effect#c.e1_vign2_roads_effect c.e1_vign1_VAT_effect#c.e1_vign2_security_effect ///
	c.e1_vign1_PIT_effect#c.e1_vign2_health_effect c.e1_vign1_PIT_effect#c.e1_vign2_roads_effect c.e1_vign1_PIT_effect#c.e1_vign2_security_effect


************************************
*4.1 MAIN EFFECTS - ANALYSIS PART 1*
************************************

*contrast with g. operator computes the differences from the grand mean

*No controls
anova E1_pay_taxes i.E1_vign1##i.E1_vign2
margins g.E1_vign1##g.E1_vign2, contrast(pveffects nowald) post

*Socio economic controls 
anova E1_pay_taxes i.E1_vign1##i.E1_vign2 i.female i.age_range2 i.education_cat i.income_level i.employed
margins g.E1_vign1##g.E1_vign2, contrast(pveffects nowald) post

*Socio economic controls + Tax controls 
anova E1_pay_taxes i.E1_vign1##i.E1_vign2 i.female i.age_range2 i.education_cat i.income_level i.employed tax_difficult tax_enforcement tax_reciprocity tax_avoidance 
margins g.E1_vign1##g.E1_vign2, contrast(pveffects nowald) post

*Socio economic controls + Covid 
anova E1_pay_taxes i.E1_vign1##i.E1_vign2 i.female i.age_range2 i.education_cat i.income_level i.employed i.covid_infection i.covid_vaccine
margins g.E1_vign1##g.E1_vign2, contrast(pveffects nowald) post

*Socio economic controls + Informality
anova E1_pay_taxes i.E1_vign1##i.E1_vign2 i.female i.age_range2 i.education_cat i.income_level i.employed i.informal
margins g.E1_vign1##g.E1_vign2, contrast(pveffects nowald) post

*Socio economic controls + Public insurance
anova E1_pay_taxes i.E1_vign1##i.E1_vign2 i.female i.age_range2 i.education_cat i.income_level i.employed i.publicinsurance
margins g.E1_vign1##g.E1_vign2, contrast(pveffects nowald) post

*Socio economic controls + public healthcare usage
anova E1_pay_taxes i.E1_vign1##i.E1_vign2 i.female i.age_range2 i.education_cat i.income_level i.employed i.publichealth_usage
margins g.E1_vign1##g.E1_vign2, contrast(pveffects nowald) post

************************************
*4.2 DATA ANALYSIS - PART 2
*SUBGROUP ANALYSIS
************************************ 

*4.2a. Nonmigrant vs Migrant 
*4.2b. Nonmigrant vs Return and Nonreturning migrant
*4.2c. Nonmigrant vs US Context

************************************
*4.2a. Nonmigrant vs Migrant 
************************************
*COMPARISON BETWEEN MIGRANTS AND NON-MIGRANTS (t-tests) 

*Socioeconomic and demographic characteristics (migrants vs nonmigrants)
estpost ttest female age_groups1 age_groups2 age_groups3 age_groups4 age_groups5 edlevel1 edlevel2 edlevel3 edlevel4 college_higher ///
	income_cat1 income_cat2 income_cat3 employed informal, by(migrant)
esttab, wide nonumber mtitle("diff.")

**DV: support for higher taxation
ttest E1_pay_taxes, by(migrant)
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.migrant i.female i.age_range2 i.education_cat i.income_level i.employed
contrast migrant, pveffects nowald
pwcompare migrant, pveffects

anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.migrant

*Interaction contrasts
contrast E1_vign1#r.migrant
contrast E1_vign2#r.migrant

*Simple effects
contrast E1_vign1@migrant
contrast E1_vign2@migrant

*Simple contrasts - tax instrument
contrast g.E1_vign1@0.migrant, nowald pveffects
contrast g.E1_vign1@1.migrant, nowald pveffects

*Simple contrasts - tax earmarking
contrast g.E1_vign2@0.migrant, nowald pveffects
contrast g.E1_vign2@1.migrant, nowald pveffects

****************************************************
*Migrants' Reactions to Health Treatment 

anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.migrant

*Interaction contrasts
contrast g1.E1_vign2#r.migrant

*Simple effects
contrast g1.E1_vign2@migrant


***************************************************************
*4.2B. NONMIGRANT VS RETURNING AND NONRETURNING MIGRANTS  
***************************************************************
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.return 
contrast return, pveffects nowald
pwcompare return, pveffects mcompare(sidak)
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.return i.female i.age_range2 i.education_cat i.income_level i.employed
contrast return, pveffects nowald
pwcompare return, pveffects mcompare(sidak)

*Interaction contrasts
contrast E1_vign1#r.return, asobserved
contrast E1_vign2#r.return, asobserved

*Simple effects
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.return 
contrast E1_vign1@return, asobserved
contrast E1_vign2@return, asobserved

*Simple contrasts - tax instrument
contrast g.E1_vign1@0.return, nowald pveffects asobserved
contrast g.E1_vign1@1.return, nowald pveffects asobserved
contrast g.E1_vign1@2.return, nowald pveffects asobserved

*Simple contrasts - tax earmarking
contrast g.E1_vign2@0.return, nowald pveffects
contrast g.E1_vign2@1.return, nowald pveffects
contrast g.E1_vign2@2.return, nowald pveffects

************************************************
*Reactions to Health Treatment - Return migrants
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.return

*Interaction contrasts
contrast g1.E1_vign2#r.return

*Simple effects
contrast g1.E1_vign2@return


**********************************************************
*4.2c. NONMIGRANT VS US CONTEXT 
**********************************************************

*******4.2c.1. Medicaid
*******4.2c.2 Obamacare
*******4.2c.3 Social assistance to migrants
*******4.2c.4 Everify
*******4.2c.5 Local immigration enforcement.

*************************************
*4.2c.1 MEDICAID (Borjas 2016)
*************************************
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.medicaid2 
contrast medicaid2, pveffects nowald
pwcompare medicaid2, pveffects mcompare(sidak)
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.medicaid2 i.female i.age_range2 i.education_cat i.income_level i.employed
contrast medicaid2, pveffects nowald
pwcompare medicaid2, pveffects mcompare(sidak)

*Simple effects
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.medicaid2 
contrast E1_vign1@medicaid2, asobserved
contrast E1_vign2@medicaid2, asobserved

*Simple contrasts - tax instrument
contrast g.E1_vign1@0.medicaid2, nowald pveffects asobserved
contrast g.E1_vign1@1.medicaid2, nowald pveffects asobserved
contrast g.E1_vign1@2.medicaid2, nowald pveffects asobserved

*Simple contrasts - tax earmarking
contrast g.E1_vign2@0.medicaid2, nowald pveffects
contrast g.E1_vign2@1.medicaid2, nowald pveffects
contrast g.E1_vign2@2.medicaid2, nowald pveffects

*Interaction contrasts
contrast E1_vign1#r.medicaid2, asobserved
contrast E1_vign2#r.medicaid2, asobserved


****************************************************
*Reactions to Health Treatment - Medicaid 

*Migrant households vs Non-migrant households 
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.medicaid2

*Interaction contrasts
contrast g1.E1_vign2#r.medicaid2

*Simple effects
contrast g1.E1_vign2@medicaid2


***************************************
*4.2c.2 OBAMACARE (MEDICAID EXPANSION) 
***************************************
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.obamacare 
contrast obamacare, pveffects nowald
pwcompare obamacare, pveffects mcompare(sidak)
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.obamacare i.female i.age_range2 i.education_cat i.income_level i.employed
contrast obamacare, pveffects nowald
pwcompare obamacare, pveffects mcompare(sidak)

*Simple effects
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.obamacare 
contrast E1_vign1@obamacare, asobserved
contrast E1_vign2@obamacare, asobserved

*Simple contrasts - tax instrument
contrast g.E1_vign1@0.obamacare, nowald pveffects asobserved
contrast g.E1_vign1@1.obamacare, nowald pveffects asobserved
contrast g.E1_vign1@2.obamacare, nowald pveffects asobserved

*Simple contrasts - tax earmarking
contrast g.E1_vign2@0.obamacare, nowald pveffects
contrast g.E1_vign2@1.obamacare, nowald pveffects
contrast g.E1_vign2@2.obamacare, nowald pveffects

*Interaction contrasts
contrast E1_vign1#r.obamacare, asobserved
contrast E1_vign2#r.obamacare, asobserved

****************************************************
*Reactions to Health Treatment - Obamacare

*Migrant households vs Non-migrant households - Obamacare
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.obamacare

*Interaction contrasts
contrast g1.E1_vign2#r.obamacare

*Simple effects
contrast g1.E1_vign2@obamacare



**********************************************
*4.2c.3 SOCIAL ASSISTANCE PROGRAMS (Borjas 2016)
**********************************************
*Less generous (<= 2 programs) More generous (3+ programs)

anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.assistance_us 
contrast assistance_us, pveffects nowald
pwcompare assistance_us, pveffects mcompare(sidak)
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.assistance_us i.female i.age_range2 i.education_cat i.income_level i.employed
contrast assistance_us, pveffects nowald
pwcompare assistance_us, pveffects mcompare(sidak)

*Simple effects
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.assistance_us
contrast E1_vign1@assistance_us, asobserved
contrast E1_vign2@assistance_us, asobserved

*Simple contrasts - tax instrument
contrast g.E1_vign1@0.assistance_us, nowald pveffects asobserved
contrast g.E1_vign1@1.assistance_us, nowald pveffects asobserved
contrast g.E1_vign1@2.assistance_us, nowald pveffects asobserved

*Simple contrasts - tax earmarking (vs grand mean)
contrast g.E1_vign2@0.assistance_us, nowald pveffects
contrast g.E1_vign2@1.assistance_us, nowald pveffects
contrast g.E1_vign2@2.assistance_us, nowald pveffects

*Simple contrasts - tax earmarking (vs control group)
contrast r.E1_vign2@0.assistance_us, nowald pveffects
contrast r.E1_vign2@1.assistance_us, nowald pveffects
contrast r.E1_vign2@2.assistance_us, nowald pveffects

*Interaction contrasts
contrast E1_vign1#r.assistance_us, asobserved
contrast E1_vign2#r.assistance_us, asobserved

*****************
*4.2c.4 E-VERIFY
*****************
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.everify 
contrast everify, pveffects nowald
pwcompare everify, pveffects mcompare(sidak)
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.everify i.female i.age_range2 i.education_cat i.income_level i.employed
contrast everify, pveffects nowald
pwcompare everify, pveffects mcompare(sidak)

*Simple effects
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.everify
contrast E1_vign1@everify, asobserved
contrast E1_vign2@everify, asobserved

*Simple contrasts - tax instrument
contrast g.E1_vign1@0.everify, nowald pveffects asobserved
contrast g.E1_vign1@1.everify, nowald pveffects asobserved
contrast g.E1_vign1@2.everify, nowald pveffects asobserved
contrast g.E1_vign1@3.everify, nowald pveffects asobserved

*Simple contrasts - tax earmarking
contrast g.E1_vign2@0.everify, nowald pveffects
contrast g.E1_vign2@1.everify, nowald pveffects
contrast g.E1_vign2@2.everify, nowald pveffects
contrast g.E1_vign2@3.everify, nowald pveffects

*Interaction contrasts
contrast E1_vign1#r.everify, asobserved
contrast E1_vign2#r.everify, asobserved



***********************************************************************
*4.2c.5 STATE IMMIGRATION ENFORCEMENT

anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.police_us 
contrast police_us, pveffects nowald
pwcompare police_us, pveffects mcompare(sidak)
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.police_us i.female i.age_range2 i.education_cat i.income_level i.employed
contrast police_us, pveffects nowald
pwcompare police_us, pveffects mcompare(sidak)

*Simple effects
anova E1_pay_taxes i.E1_vign1##i.E1_vign2##i.police_us 
contrast E1_vign1@police_us, asobserved
contrast E1_vign2@police_us, asobserved

*Simple contrasts - tax instrument
contrast g.E1_vign1@0.police_us, nowald pveffects asobserved
contrast g.E1_vign1@1.police_us, nowald pveffects asobserved
contrast g.E1_vign1@2.police_us, nowald pveffects asobserved

*Simple contrasts - tax earmarking
contrast g.E1_vign2@0.police_us, nowald pveffects
contrast g.E1_vign2@1.police_us, nowald pveffects
contrast g.E1_vign2@2.police_us, nowald pveffects

*Interaction contrasts
contrast E1_vign1#r.police_us, asobserved
contrast E1_vign2#r.police_us, asobserved

